package com.hksj.sftcm.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hksj.common.core.model.Rest;
import com.hksj.sftcm.dto.SftcmDeviceDTO;
import com.hksj.sftcm.service.SftcmDeviceService;
import com.hksj.sftcm.vo.SftcmDeviceVO;
import com.hksj.sftcm.vo.SftcmHistoryDeviceVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Api(tags = "专用设施温度-专用设施温度设备管理")
@RestController
@RequestMapping("/api/sftcmDevice")
public class SftcmDeviceController {

    @Resource
    private SftcmDeviceService sftcmDeviceService;

    @ApiOperation(value = "专用设施设备分页查询")
    @PostMapping("/querySftcmDeviceByPage")
    public Rest<IPage<SftcmDeviceVO>> querySftcmDeviceByPage(@RequestBody SftcmDeviceDTO dto){
        return Rest.ok(sftcmDeviceService.querySftcmDeviceByPage(dto));
    }

    @ApiOperation(value = "专用设施设备历史数据趋势")
    @PostMapping("/querySftcmDeviceHistoryByPage")
    public Rest<IPage<SftcmHistoryDeviceVO>> querySftcmDeviceHistoryByPage(@RequestBody SftcmDeviceDTO dto){
        return Rest.ok(sftcmDeviceService.querySftcmDeviceHistoryByPage(dto));
    }

    @ApiOperation(value = "专用设施设备历史记录导出")
    @PostMapping("/exportSftcmHistoryDeviceInfo")
    public void exportSftcmHistoryDeviceInfo(@RequestBody SftcmDeviceDTO dto, HttpServletResponse response) throws Exception {
        sftcmDeviceService.exportSftcmHistoryDeviceInfo(dto,response);
    }

}
